<template>
  <div class="mask">
    <div class="login">
      <component :is="is" @change="change"></component>
    </div>
  </div>
</template>

<script>
import Login from "./login";
import Register from "./Register";
export default {
  components: {
    Login,
    Register,
  },
  data() {
    return {
      is: "Login",
      isState: false,
    };
  },
  methods: {
    change() {
      this.isState = !this.isState;
      if (this.isState) {
        this.is = "Register";
      } else {
        this.is = "Login";
      }
    },
  },
};
</script>

<style scoped>
.mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2d3a4b;
}
.login {
  width: 500px;
  box-sizing: border-box;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding-top: 40px;
  padding-right: 40px;
  padding-left: 40px;
}
</style>